cd "~/dropbox/immigration conjoint/Replication Files/Data"
use "ipsos_rep", clear

cd "~/dropbox/immigration conjoint/Replication Files/Output"
set scheme plotplain

// Figure E1: Outcome Support

reg support_exp8 exp8_country_1 i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2  exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2, vce(cluster respondent_serial) 

coefplot, drop(_cons) xline(0) omitted baselevels graphregion(color(white)) ///
 xtitle ("") headings(exp8_country_1="{bf:Country}" ///
 exp8_skill_1="{bf:Skills}" exp8_age_1="{bf:Age}" exp8_gender_1="{bf:Gender}" ///
 exp8_number_1="{bf:Number}" exp8_ideology_2="{bf:Ideology}" ///
 exp8_relatives_2="{bf:Relatives}" exp8_reasons_1="{bf:Reason}") ///
 coeflabels (exp1_army_enc_1="Venezuela" exp8_pro_2="Professional" exp8_age_2="More than 40" exp8_gender_2="Woman" ///
 exp8_number_2="With family" exp8_ideology_1="Right" exp8_relatives_1="Yes" ///
 exp8_reason_2="Economic opportunities", labsize(vsmall))
 graph export "plot_conjoint2.png", replace 
 
// Table E1: by Venezuelan relatives

reg  choice_exp8 i1.exp8_skill i.exp8_country_1##ib2.f2_1 exp8_country_2  ///
exp8_gender_1 exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial) 

outreg2 using conjoint_int_rel,  tex label  ctitle("Choice")  ///
keep(i.exp8_country_1##ib2.f2_1) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  replace 

reg  support_exp8 i1.exp8_skill i.exp8_country_1##ib2.f2_1 exp8_country_2 exp8_country_1  ///
exp8_gender_1 exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1 , vce(cluster respondent_serial) 

outreg2 using conjoint_int_rel,  tex label  ctitle("Choice")  ///
keep(i.exp8_country_1##ib2.f2_1 ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 

 
// Table E2: By frequent contact

reg choice_exp8 exp8_country_1##i1.freq_ven i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2  exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2, vce(cluster respondent_serial) 


outreg2 using conjoint_freq,  tex   label ctitle("Choice") dec(3) ///
keep(exp8_country_1##i1.freq_ven ) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted category: Venezuela", *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  replace 

reg support_exp8 exp8_country_1##i1.freq_ven i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2  exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2, vce(cluster respondent_serial) 

outreg2 using conjoint_freq,  tex label  ctitle("Grade")  ///
keep(exp8_country_1##i1.freq_ven ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 


// Table E3: By Education

reg  choice_exp8 i1.exp8_skill##i.college exp8_country_2 exp8_country_1  ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_college,  tex   label ctitle("Choice") dec(3) ///
keep( i1.exp8_skill##i.college ) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted category: Professional", *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  replace 

reg support_exp8 i1.exp8_skill##i.college exp8_country_2 exp8_country_1 exp8_skill_2 exp8_skill_1 ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_college,  tex label  ctitle("Grade")  ///
keep( i1.exp8_skill##i.college ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs append 

// Table E4: By income


reg  choice_exp8 i1.exp8_skill##ib3.nse_rec5 exp8_country_2 exp8_country_1  ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)


outreg2 using conjoint_nse,  tex label  ctitle("Choice")  ///
keep( i1.exp8_skill##ib1.nse_rec5 ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  replace 

reg  support_exp8 i1.exp8_skill##ib3.nse_rec5 exp8_country_2 exp8_country_1  ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)


outreg2 using conjoint_nse,  tex label  ctitle("Support")  ///
keep(i1.exp8_skill##ib1.nse_rec5 ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 



// Table E5: By ideology

reg  choice_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_2##i.right  exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_ideology,  tex   label ctitle("Choice") dec(3) ///
keep( exp8_ideology_2##i1.right ) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted category: Professional", *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  replace 

reg support_exp8 i1.exp8_skill exp8_country_2 exp8_country_1 exp8_skill_2 exp8_skill_1 ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_2##i.right exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_ideology,  tex label  ctitle("Grade")  ///
keep( exp8_ideology_2##i1.right ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 

reg  choice_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_2##i.left exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_ideology,  tex   label ctitle("Choice") dec(3) ///
keep( exp8_ideology_2##i1.left) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted category: Professional", *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  append 

reg support_exp8 i1.exp8_skill exp8_country_2 exp8_country_1 exp8_skill_2 exp8_skill_1 ///
exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_2##i.left exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)

outreg2 using conjoint_ideology,  tex label  ctitle("Grade")  ///
keep( exp8_ideology_2##i1.left ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 

// Table E6: Interaction male and less than 40

reg  choice_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)


outreg2 using conjoint_int_atr,  tex label  ctitle("Choice")  ///
keep( i.exp8_gender_1##i.exp8_age_1 ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  replace 

reg  support_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_2 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1, vce(cluster respondent_serial)


outreg2 using conjoint_int_atr,  tex label  ctitle("Support")  ///
keep(i.exp8_gender_1##i.exp8_age_1 ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 

// Table E7: Interaction male and less than 40 by gender

reg  choice_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1 if gender == 1, vce(cluster respondent_serial) // male

outreg2 using conjoint_int_gender,  tex label  ctitle("Choice")  ///
keep( i.exp8_gender_1##i.exp8_age_1  ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  replace 


reg  support_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1 if gender == 1, vce(cluster respondent_serial) // male

outreg2 using conjoint_int_gender,  tex label  ctitle("Choice")  ///
keep(i.exp8_gender_1##i.exp8_age_1  ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 


reg  choice_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1 if gender == 2, vce(cluster respondent_serial) // female

outreg2 using conjoint_int_gender,  tex label  ctitle("Choice")  ///
keep(i.exp8_gender_1##i.exp8_age_1  ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 


reg  support_exp8 i1.exp8_skill exp8_country_2 exp8_country_1  ///
i.exp8_gender_1##i.exp8_age_1 exp8_age_1 exp8_gender_2 exp8_gender_1 exp8_number_2 exp8_number_1 ///
exp8_ideology_1 exp8_ideology_2 exp8_relatives_1 exp8_relatives_2 ///
exp8_reasons_2 exp8_reasons_1 if gender == 2, vce(cluster respondent_serial) // female

outreg2 using conjoint_int_gender,  tex label  ctitle("Choice")  ///
keep(i.exp8_gender_1##i.exp8_age_1  ) addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs  append 
